Get rid of a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().
authorOwen Taylor <otaylor@redhat.com>
Fri, 2 Feb 2001 17:53:29 +0000 (17:53 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Fri, 2 Feb 2001 17:53:29 +0000 (17:53 +0000)
Fri Feb  2 12:26:50 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkrc.c (gtk_rc_add_initial_default_files): Get rid of
a bunch of g_strdup_printf("%s%s") in favor of g_strconcat().

* gtk/gtkrc.c Makefile.am: Use $(libdir), not $(exe_prefix),
since some people set $(libdir) separately. (#1290, David Kaelbling)

Thu Feb  1 18:25:46 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkfilesel.c: If PATH_MAX and MAXPATHLEN are not
defined, define MAXPATHLEN to 2048. (The Hurd doesn't have
MAXPATHLEN, but the code here depends on a fixed value.)
(#4524)

Wed Jan 31 22:01:04 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkhandlebox.c (gtk_handle_box_button_changed): Handle the case
where child == NULL and handle_position == RIGHT or BOTTOM. (#8041g)

Wed Jan 31 21:20:39 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkctree.c (real_tree_move): If the node being moved isn't
viewable there is no way that moving the node will cause the
focus row to become not viewable, so omit check on the visibility
of new_sibling, which is irrelevant. (Fixes #8002, David Helder)

Wed Jan 31 20:38:17 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkentry.c (gtk_entry_commit_cb): Delete the current
selection before inserting new text.

Wed Jan 31 18:49:33 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkoptionmenu.c (gtk_option_menu_item_state_changed_cb):
Make the sensitivity of the reparented child track that of
the original parent menu item. (#34218, David Hodson)

* gtk/gtkoptionmenu.c (gtk_option_menu_item_destroy_cb): Handle
the case where the current item is destroyed properly.

* gtk/gtkoptionmenu.c: Some additional code cleanups and fix
some edge cases with child-less menuitems.

Wed Jan 31 17:16:13 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkcombo.c (gtk_combo_window_key_press): Make Return
key pop down window. (#12074, Jon K Hellan)

Wed Jan 31 16:21:42 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtklist.c (gtk_list_signal_item_toggle): Don't allow
toggling of rows off in BROWSE or EXTENDED mode. (#12072, Jon K Hellan)
The solution here isn't perfect - you get an extraneous
emission of "toggle", which could conceivably confuse an app,
but better than the current situation. LXR search seems to
indicate that no apps in GNOME CVS connect to "toggle".

Wed Jan 31 15:46:13 2001  Owen Taylor  <otaylor@redhat.com>

        * gtk/Makefile.am (libgtkinclude_HEADERS): Move gtkcompat.h from
        gtk_public_h_sources to directly here to avoid warning when
        building srcdir != builddir. (#9656)

Tue Jan 30 19:49:02 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkrange.c: Patch from Kipp Hickman to make the event
handlers in gtkrange.c return the proper values (TRUE == handled)
(#10316).

This is just the tip of the iceberg, but gtkrange.c is the
most common place where the propagation is problematical,
and also a place where it is almost certainly safe to change
this in the stable branch.

(You don't want right click popups on a range control or anything...)

Tue Jan 30 18:57:59 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtktext.c (clear_focus_area): We need to clear the focus
area on focus out, even if a background pixmap isn't set.
(#13941)

Tue Jan 30 18:24:10 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtknotebook.c (gtk_notebook_set_shape): Fix from Sean Cunningham
to deal with setting the shape properly when scrolling arrows are
turned on, but not visible because there is sufficient space.
(#13432)

Tue Jan 30 16:39:25 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkitemfactory.c (gtk_item_factory_delete_item): For menu
items with submenus, destroy the item along with the submenu.
(#7841, Brian Masney(?)) Also, handle paths of the form '<foo>/abcd...'
properly.

* gtk/testgtk.c (menu_items): Add a dummy branch that we delete
later.

Tue Jan 30 15:51:25 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkwindow.c (gtk_window_real_set_focus): Fix a problem where
the focus widget sometimes wasn't drawn with the default if there
was no default widget.

* gtk/gtkstyle.c (gtk_style_real_unrealize): free colors,
unreference pixmaps.

* gtk/gtkstyle.c (gtk_style_realize): Reference colormap
for some extra safety.

Mon Jan 29 19:00:01 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtk{ctree.c,clist.c} (set_cell_contents): Handle setting
the text of a cell to the old pointer value better, by
copying the new text before freeing the old text. Some code
cleanup. (#8079, Karl Nelson)

Mon Jan 29 16:50:19 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtklabel.[ch] gtk/gtkframe.[ch]: Make gtk_label_get_text()
gtk_frame_get_label() non strdup'ing, and G_CONST_RETURN.

Mon Jan 29 15:22:51 2001  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkmenu.c (gtk_menu_remove): When removing an
item from a menu, check to see if it matches
menu->old_active_menu_item, and if so, unref and clear
old_active_menu_item (Patch from Pavel Cisler)

* gtk/gtkmenushell.c (gtk_menu_shell_remove): Unset
menu_shell->active_menu_item, if it is the child being
removed. (Patch based on that of Gene Ragan, #50337)

25 files changed:
gdk/x11/gdkevents-x11.c
gtk/Makefile.am
gtk/gtkclist.c
gtk/gtkcombo.c
gtk/gtkctree.c
gtk/gtkentry.c
gtk/gtkfilesel.c
gtk/gtkframe.c
gtk/gtkframe.h
gtk/gtkhandlebox.c
gtk/gtkitemfactory.c
gtk/gtklabel.c
gtk/gtklabel.h
gtk/gtklist.c
gtk/gtkmenu.c
gtk/gtkmenushell.c
gtk/gtknotebook.c
gtk/gtkoptionmenu.c
gtk/gtkrange.c
gtk/gtkrc.c
gtk/gtkstyle.c
gtk/gtktext.c
gtk/gtkwindow.c
gtk/testgtk.c
tests/testgtk.c

index f0cb18affcc9f3fa25a448a8669d482d0dca307b..a005e5a148c360010f4db17ce19e91292f819e2d 100644 (file)
@@ -1307,6 +1307,16 @@ gdk_events_queue (void)
 #else
       XNextEvent (gdk_display, &xevent);
 #endif
+
+      switch (xevent.type)
+       {
+       case KeyPress:
+       case KeyRelease:
+         break;
+       default:
+         if (XFilterEvent (&xevent, None))
+           continue;
+       }
       
       event = gdk_event_new ();
       
index 0869168b66839e9eee681b93610e41c2bccb20a6..230f78445dbf47b62aa4a9bfa813de67990b0ad8 100644 (file)
@@ -5,7 +5,7 @@ SUBDIRS=stock-icons
 INCLUDES = @STRIP_BEGIN@ \
        -DG_LOG_DOMAIN=\"Gtk\"                          \
        -DGTK_DISABLE_COMPAT_H                          \
-       -DGTK_EXE_PREFIX=\"$(exec_prefix)\"             \
+       -DGTK_LIBDIR=\"$(libdir)\"                      \
        -DGTK_DATA_PREFIX=\"$(prefix)\"                 \
        -DGTK_SYSCONFDIR=\"$(sysconfdir)\"              \
        -DGTK_LOCALEDIR=\"$(gtklocaledir)\"             \
@@ -70,7 +70,6 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
        gtkcolorsel.h           \
        gtkcolorseldialog.h     \
        gtkcombo.h              \
-       gtkcompat.h             \
        gtkcontainer.h          \
        gtkctree.h              \
        gtkcurve.h              \
@@ -423,7 +422,7 @@ gtk_extra_sources = @STRIP_BEGIN@ \
 #
 # setup GTK+ sources and their dependancies
 #
-gtk_target_headers = $(gtk_public_h_sources) $(gtk_built_public_sources)
+gtk_target_headers = $(gtk_public_h_sources) $(gtk_built_public_sources) gtkcompat.h
 gtk_target_sources = $(gtk_c_sources)
 MAINTAINERCLEANFILES += $(gtk_built_sources)
 EXTRA_HEADERS +=
index 0ab00b0abf9ee91551b4e6324e66e4d0edf3161f..69cb38470c7526c93c5efa2b27210f7398aa6098 100644 (file)
@@ -2421,7 +2421,10 @@ set_cell_contents (GtkCList    *clist,
                   GdkBitmap   *mask)
 {
   GtkRequisition requisition;
-
+  gchar *old_text = NULL;
+  GdkPixmap *old_pixmap = NULL;
+  GdkBitmap *old_mask = NULL;
+  
   g_return_if_fail (clist != NULL);
   g_return_if_fail (GTK_IS_CLIST (clist));
   g_return_if_fail (clist_row != NULL);
@@ -2436,18 +2439,16 @@ set_cell_contents (GtkCList    *clist,
     case GTK_CELL_EMPTY:
       break;
     case GTK_CELL_TEXT:
-      g_free (GTK_CELL_TEXT (clist_row->cell[column])->text);
+      old_text = GTK_CELL_TEXT (clist_row->cell[column])->text;
       break;
     case GTK_CELL_PIXMAP:
-      gdk_pixmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap);
-      if (GTK_CELL_PIXMAP (clist_row->cell[column])->mask)
-       gdk_bitmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->mask);
+      old_pixmap = GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap;
+      old_mask = GTK_CELL_PIXMAP (clist_row->cell[column])->mask;
       break;
     case GTK_CELL_PIXTEXT:
-      g_free (GTK_CELL_PIXTEXT (clist_row->cell[column])->text);
-      gdk_pixmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap);
-      if (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask)
-       gdk_bitmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask);
+      old_text = GTK_CELL_PIXTEXT (clist_row->cell[column])->text;
+      old_pixmap = GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap;
+      old_mask = GTK_CELL_PIXTEXT (clist_row->cell[column])->mask;
       break;
     case GTK_CELL_WIDGET:
       /* unimplimented */
@@ -2458,6 +2459,8 @@ set_cell_contents (GtkCList    *clist,
 
   clist_row->cell[column].type = GTK_CELL_EMPTY;
 
+  /* Note that pixmap and mask were already ref'ed by the caller
+   */
   switch (type)
     {
     case GTK_CELL_TEXT:
@@ -2493,6 +2496,13 @@ set_cell_contents (GtkCList    *clist,
   if (clist->column[column].auto_resize &&
       !GTK_CLIST_AUTO_RESIZE_BLOCKED(clist))
     column_auto_resize (clist, clist_row, column, requisition.width);
+
+  if (old_text)
+    g_free (old_text);
+  if (old_pixmap)
+    gdk_pixmap_unref (old_pixmap);
+  if (old_mask)
+    gdk_pixmap_unref (old_mask);
 }
 
 PangoLayout *
index dea6d8956c6a1741315bf975a136001313decae0..3d063ee4397a05583a912d296bca838353b047af 100644 (file)
@@ -46,51 +46,54 @@ const gchar *gtk_combo_string_key = "gtk-combo-string-value";
 #define COMBO_LIST_MAX_HEIGHT  (400)
 #define        EMPTY_LIST_HEIGHT       (15)
 
-static void         gtk_combo_class_init      (GtkComboClass *klass);
-static void         gtk_combo_init            (GtkCombo      *combo);
-static void         gtk_combo_destroy         (GtkObject     *combo);
-static GtkListItem *gtk_combo_find            (GtkCombo      *combo);
-static gchar *      gtk_combo_func            (GtkListItem  *li);
-static gint         gtk_combo_focus_idle      (GtkCombo      *combo);
-static gint         gtk_combo_entry_focus_out (GtkEntry      *entry, 
-                                               GdkEventFocus *event, 
-                                               GtkCombo      *combo);
-static void         gtk_combo_get_pos         (GtkCombo      *combo, 
-                                               gint          *x, 
-                                               gint          *y, 
-                                               gint          *height, 
-                                               gint          *width);
-static void         gtk_combo_popup_list      (GtkCombo      *combo);
-static void         gtk_combo_activate        (GtkWidget        *widget,
-                                              GtkCombo         *combo);
+static void         gtk_combo_class_init         (GtkComboClass    *klass);
+static void         gtk_combo_init               (GtkCombo         *combo);
+static void         gtk_combo_destroy            (GtkObject        *combo);
+static GtkListItem *gtk_combo_find               (GtkCombo         *combo);
+static gchar *      gtk_combo_func               (GtkListItem      *li);
+static gint         gtk_combo_focus_idle         (GtkCombo         *combo);
+static gint         gtk_combo_entry_focus_out    (GtkEntry         *entry,
+                                                 GdkEventFocus    *event,
+                                                 GtkCombo         *combo);
+static void         gtk_combo_get_pos            (GtkCombo         *combo,
+                                                 gint             *x,
+                                                 gint             *y,
+                                                 gint             *height,
+                                                 gint             *width);
+static void         gtk_combo_popup_list         (GtkCombo         *combo);
+static void         gtk_combo_activate           (GtkWidget        *widget,
+                                                 GtkCombo         *combo);
 static void         gtk_combo_popup_button_press (GtkWidget        *button,
                                                  GdkEventButton   *event,
                                                  GtkCombo         *combo);
 static void         gtk_combo_popup_button_leave (GtkWidget        *button,
                                                  GdkEventCrossing *event,
                                                  GtkCombo         *combo);
-static void         gtk_combo_update_entry    (GtkList       *list, 
-                                               GtkCombo      *combo);
-static void         gtk_combo_update_list     (GtkEntry      *entry, 
-                                               GtkCombo      *combo);
-static gint         gtk_combo_button_press    (GtkWidget     *widget,
-                                              GdkEvent      *event,
-                                              GtkCombo      *combo);
-static gint         gtk_combo_button_release  (GtkWidget     *widget,
-                                              GdkEvent      *event,
-                                              GtkCombo      *combo);
-static gint         gtk_combo_list_enter      (GtkWidget        *widget,
-                                              GdkEventCrossing *event,
-                                              GtkCombo         *combo);
-static gint         gtk_combo_list_key_press  (GtkWidget     *widget, 
-                                               GdkEventKey   *event, 
-                                               GtkCombo      *combo);
-static gint         gtk_combo_entry_key_press (GtkEntry      *widget, 
-                                               GdkEventKey   *event, 
-                                               GtkCombo      *combo);
-static void         gtk_combo_item_destroy    (GtkObject     *object);
-static void         gtk_combo_size_allocate   (GtkWidget     *widget,
-                                              GtkAllocation *allocation);
+static void         gtk_combo_update_entry       (GtkList          *list,
+                                                 GtkCombo         *combo);
+static void         gtk_combo_update_list        (GtkEntry         *entry,
+                                                 GtkCombo         *combo);
+static gint         gtk_combo_button_press       (GtkWidget        *widget,
+                                                 GdkEvent         *event,
+                                                 GtkCombo         *combo);
+static gint         gtk_combo_button_release     (GtkWidget        *widget,
+                                                 GdkEvent         *event,
+                                                 GtkCombo         *combo);
+static gint         gtk_combo_list_enter         (GtkWidget        *widget,
+                                                 GdkEventCrossing *event,
+                                                 GtkCombo         *combo);
+static gint         gtk_combo_list_key_press     (GtkWidget        *widget,
+                                                 GdkEventKey      *event,
+                                                 GtkCombo         *combo);
+static gint         gtk_combo_entry_key_press    (GtkEntry         *widget,
+                                                 GdkEventKey      *event,
+                                                 GtkCombo         *combo);
+static gint         gtk_combo_window_key_press   (GtkWidget        *window,
+                                                 GdkEventKey      *event,
+                                                 GtkCombo         *combo);
+static void         gtk_combo_item_destroy       (GtkObject        *object);
+static void         gtk_combo_size_allocate      (GtkWidget        *widget,
+                                                 GtkAllocation    *allocation);
 
 static GtkHBoxClass *parent_class = NULL;
 
@@ -208,6 +211,34 @@ gtk_combo_entry_key_press (GtkEntry * entry, GdkEventKey * event, GtkCombo * com
   return FALSE;
 }
 
+static int
+gtk_combo_window_key_press (GtkWidget   *window,
+                           GdkEventKey *event,
+                           GtkCombo    *combo)
+{
+  GList *li;
+
+  if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter)
+    {
+      if (GTK_WIDGET_VISIBLE (combo->popwin))
+       {
+         gtk_widget_hide (combo->popwin);
+         
+         if (GTK_WIDGET_HAS_GRAB (combo->popwin))
+           {
+             gtk_grab_remove (combo->popwin);
+             gdk_pointer_ungrab (event->time);
+           }
+       }
+
+      gtk_signal_emit_stop_by_name (GTK_OBJECT (window), "key_press_event");
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 static GtkListItem *
 gtk_combo_find (GtkCombo * combo)
 {
@@ -686,6 +717,9 @@ gtk_combo_init (GtkCombo * combo)
   combo->popwin = gtk_window_new (GTK_WINDOW_POPUP);
   gtk_widget_ref (combo->popwin);
   gtk_window_set_policy (GTK_WINDOW (combo->popwin), 1, 1, 0);
+
+  gtk_signal_connect (GTK_OBJECT (combo->popwin), "key_press_event",
+                     GTK_SIGNAL_FUNC (gtk_combo_window_key_press), combo);
   
   gtk_widget_set_events (combo->popwin, GDK_KEY_PRESS_MASK);
 
index 3ead47c46c370c77733a43b11b14a6bdbd6fe74b..acc7e128b2d3963df784f480d251c4a899c79d96 100644 (file)
@@ -2418,8 +2418,7 @@ real_tree_move (GtkCTree     *ctree,
   gtk_clist_freeze (clist);
 
   work = NULL;
-  if (gtk_ctree_is_viewable (ctree, node) ||
-      gtk_ctree_is_viewable (ctree, new_sibling))
+  if (gtk_ctree_is_viewable (ctree, node))
     work = GTK_CTREE_NODE (g_list_nth (clist->row_list, clist->focus_row));
       
   gtk_ctree_unlink (ctree, node, FALSE);
@@ -2904,6 +2903,9 @@ set_cell_contents (GtkCList    *clist,
   gboolean visible = FALSE;
   GtkCTree *ctree;
   GtkRequisition requisition;
+  gchar *old_text = NULL;
+  GdkPixmap *old_pixmap = NULL;
+  GdkBitmap *old_mask = NULL;
 
   g_return_if_fail (clist != NULL);
   g_return_if_fail (GTK_IS_CTREE (clist));
@@ -2930,26 +2932,17 @@ set_cell_contents (GtkCList    *clist,
     {
     case GTK_CELL_EMPTY:
       break;
-      
     case GTK_CELL_TEXT:
-      g_free (GTK_CELL_TEXT (clist_row->cell[column])->text);
+      old_text = GTK_CELL_TEXT (clist_row->cell[column])->text;
       break;
     case GTK_CELL_PIXMAP:
-      gdk_pixmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap);
-      if (GTK_CELL_PIXMAP (clist_row->cell[column])->mask)
-       gdk_bitmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->mask);
+      old_pixmap = GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap;
+      old_mask = GTK_CELL_PIXMAP (clist_row->cell[column])->mask;
       break;
     case GTK_CELL_PIXTEXT:
-      if (GTK_CELL_PIXTEXT (clist_row->cell[column])->text)
-       g_free (GTK_CELL_PIXTEXT (clist_row->cell[column])->text);
-      if (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap)
-       {
-         gdk_pixmap_unref
-           (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap);
-         if (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask)
-           gdk_bitmap_unref
-             (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask);
-       }
+      old_text = GTK_CELL_PIXTEXT (clist_row->cell[column])->text;
+      old_pixmap = GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap;
+      old_mask = GTK_CELL_PIXTEXT (clist_row->cell[column])->mask;
       break;
     case GTK_CELL_WIDGET:
       /* unimplimented */
@@ -2963,6 +2956,8 @@ set_cell_contents (GtkCList    *clist,
   if (column == ctree->tree_column && type != GTK_CELL_EMPTY)
     type = GTK_CELL_PIXTEXT;
 
+  /* Note that pixmap and mask were already ref'ed by the caller
+   */
   switch (type)
     {
     case GTK_CELL_TEXT:
@@ -3017,6 +3012,13 @@ set_cell_contents (GtkCList    *clist,
   if (visible && clist->column[column].auto_resize &&
       !GTK_CLIST_AUTO_RESIZE_BLOCKED (clist))
     column_auto_resize (clist, clist_row, column, requisition.width);
+
+  if (old_text)
+    g_free (old_text);
+  if (old_pixmap)
+    gdk_pixmap_unref (old_pixmap);
+  if (old_mask)
+    gdk_pixmap_unref (old_mask);
 }
 
 static void 
index 7f471229edd1514372a1f73b84112ea6b799c8b7..a74589936bcf60167d63083a8906fdbf9206e937 100644 (file)
@@ -1732,6 +1732,8 @@ gtk_entry_commit_cb (GtkIMContext *context,
   GtkEditable *editable = GTK_EDITABLE (entry);
   gint tmp_pos = entry->current_pos;
 
+  gtk_editable_delete_selection (editable);
+
   gtk_editable_insert_text (editable, str, strlen (str), &tmp_pos);
   gtk_editable_set_position (editable, tmp_pos);
 }
index 0d75338f6317fdb20171b311f8188f6859fd2444..538f7996362df36ee483723fc2fd25a8bfe4beb3 100644 (file)
 #define FILE_LIST_WIDTH  180
 #define FILE_LIST_HEIGHT 180
 
+/* The Hurd doesn't define either PATH_MAX or MAXPATHLEN, so we put this
+ * in here, since the rest of the code in the file does require some
+ * fixed maximum.
+ */
+#ifndef MAXPATHLEN
+#  ifdef PATH_MAX
+#    define MAXPATHLEN PATH_MAX
+#  else
+#    define MAXPATHLEN 2048
+#  endif
+#endif
+
 /* I've put this here so it doesn't get confused with the 
  * file completion interface */
 typedef struct _HistoryCallbackArg HistoryCallbackArg;
index 02921ef10a82992c4704dab3fb8952ef7c5f39bd..be0ea17139a9575437f157aaac746956262247ed 100644 (file)
@@ -73,12 +73,6 @@ static void gtk_frame_real_compute_child_allocation (GtkFrame      *frame,
 static GtkBinClass *parent_class = NULL;
 
 
-/* Here until I convince timj about memory management behavior
- */
-gchar *    gtk_frame_get_label        (GtkFrame      *frame);
-gchar *    gtk_label_get_text (GtkLabel         *label);
-
-
 GtkType
 gtk_frame_get_type (void)
 {
@@ -276,7 +270,7 @@ gtk_frame_set_label (GtkFrame *frame,
  *               was no label widget or the lable widget was not
  *               a #GtkLabel. This value must be freed with g_free().
  **/
-gchar *
+G_CONST_RETURN gchar *
 gtk_frame_get_label (GtkFrame *frame)
 {
   g_return_val_if_fail (frame != NULL, NULL);
index 6eb3f4dec8cba92fe84b280637b14d33a79d90ab..a29fb7293108f1794218ccaaa1d13a4c8cbebee2 100644 (file)
@@ -70,10 +70,11 @@ struct _GtkFrameClass
 
 GtkType    gtk_frame_get_type         (void) G_GNUC_CONST;
 GtkWidget* gtk_frame_new              (const gchar   *label);
-void       gtk_frame_set_label        (GtkFrame      *frame,
-                                      const gchar   *label);
-/* Temporarily commented out until memory management behavior is figured out */
-/* gchar *    gtk_frame_get_label        (GtkFrame      *frame); */
+
+void                  gtk_frame_set_label (GtkFrame    *frame,
+                                          const gchar *label);
+G_CONST_RETURN gchar *gtk_frame_get_label (GtkFrame    *frame);
+
 void       gtk_frame_set_label_widget (GtkFrame      *frame,
                                       GtkWidget     *label_widget);
 void       gtk_frame_set_label_align  (GtkFrame      *frame,
index c834ef459aa1d4c3a49360edd030be99e34a1d18..ca2dd0321f081e4a40a4ef64a0d07037794c1fce 100644 (file)
@@ -443,6 +443,7 @@ gtk_handle_box_style_set (GtkWidget *widget,
                          GtkStyle  *previous_style)
 {
   GtkHandleBox *hb;
+  GdkRectangle new_area;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
@@ -880,27 +881,29 @@ gtk_handle_box_button_changed (GtkWidget      *widget,
        return FALSE;
 
       child = GTK_BIN (hb)->child;
-      
-      switch (hb->handle_position)
+
+      if (child)
        {
-       case GTK_POS_LEFT:
-         in_handle = event->x < DRAG_HANDLE_SIZE;
-         break;
-       case GTK_POS_TOP:
-         in_handle = event->y < DRAG_HANDLE_SIZE;
-         break;
-       case GTK_POS_RIGHT:
-         in_handle = event->x > 2 * GTK_CONTAINER (hb)->border_width + child->allocation.width;
-         break;
-       case GTK_POS_BOTTOM:
-         in_handle = event->y > 2 * GTK_CONTAINER (hb)->border_width + child->allocation.height;
-         break;
-       default:
-         in_handle = FALSE;
-         break;
+         switch (hb->handle_position)
+           {
+           case GTK_POS_LEFT:
+             in_handle = event->x < DRAG_HANDLE_SIZE;
+             break;
+           case GTK_POS_TOP:
+             in_handle = event->y < DRAG_HANDLE_SIZE;
+             break;
+           case GTK_POS_RIGHT:
+             in_handle = event->x > 2 * GTK_CONTAINER (hb)->border_width + child->allocation.width;
+             break;
+           case GTK_POS_BOTTOM:
+             in_handle = event->y > 2 * GTK_CONTAINER (hb)->border_width + child->allocation.height;
+             break;
+           default:
+             in_handle = FALSE;
+             break;
+           }
        }
-
-      if (!child)
+      else
        {
          in_handle = FALSE;
          event_handled = TRUE;
index 202ab00be49484dc916ed592aea2aafff23f30f9..f0aecf338e768b8a2dcd992d940146ffa09678bb 100644 (file)
@@ -1318,8 +1318,7 @@ gtk_item_factory_delete_item (GtkItemFactory         *ifactory,
                              const gchar            *path)
 {
   GtkItemFactoryClass *class;
-  GtkItemFactoryItem *item;
-  gchar *fpath;
+  GtkWidget *widget;
 
   g_return_if_fail (ifactory != NULL);
   g_return_if_fail (GTK_IS_ITEM_FACTORY (ifactory));
@@ -1327,25 +1326,14 @@ gtk_item_factory_delete_item (GtkItemFactory         *ifactory,
 
   class = GTK_ITEM_FACTORY_GET_CLASS (ifactory);
 
-  fpath = g_strconcat (ifactory->path, path, NULL);
-  item = g_hash_table_lookup (class->item_ht, fpath);
-  g_free (fpath);
+  widget = gtk_item_factory_get_widget (ifactory, path);
 
-  if (item)
+  if (widget)
     {
-      GtkWidget *widget = NULL;
-      GSList *slist;
-
-      for (slist = item->widgets; slist; slist = slist->next)
-       {
-         widget = slist->data;
-
-         if (gtk_item_factory_from_widget (widget) == ifactory)
-           break;
-       }
+      if (GTK_IS_MENU (widget))
+       widget = gtk_menu_get_attach_widget (GTK_MENU (widget));
 
-      if (slist)
-       gtk_widget_destroy (widget);
+      gtk_widget_destroy (widget);
     }
 }
 
index f8ab0f5cd9f156f4f8764fa44fe808a4e6665656..1a0939a37ca4b5baba338f1b3258fb9aa92b9cbf 100644 (file)
@@ -337,13 +337,13 @@ gtk_label_set_markup_with_accel (GtkLabel    *label,
  * Return value: the text in the label widget. This value must
  * be freed with g_free().
  **/
-gchar *
+G_CONST_RETURN gchar *
 gtk_label_get_text (GtkLabel *label)
 {
   g_return_val_if_fail (label != NULL, NULL);
   g_return_val_if_fail (GTK_IS_LABEL (label), NULL);
 
-  return g_strdup (label->label);
+  return label->label;
 }
 
 void
index b0524af66c7c3a0007ef6da45e70edb1bacd7cc1..04c579c4cbbe358a23f1cf8967e40e3f8bec1941 100644 (file)
@@ -71,8 +71,11 @@ struct _GtkLabelClass
 
 GtkType    gtk_label_get_type       (void) G_GNUC_CONST;
 GtkWidget *gtk_label_new            (const char       *str);
-void       gtk_label_set_text       (GtkLabel         *label,
-                                    const char       *str);
+
+void                  gtk_label_set_text (GtkLabel   *label,
+                                         const char *str);
+G_CONST_RETURN gchar *gtk_label_get_text (GtkLabel   *label);
+
 void       gtk_label_set_attributes (GtkLabel         *label,
                                      PangoAttrList    *attrs);
 
@@ -81,8 +84,6 @@ void  gtk_label_set_markup            (GtkLabel    *label,
 guint gtk_label_set_markup_with_accel (GtkLabel    *label,
                                        const gchar *str);
                                             
-
-/* Temporarily commented out until memory management behavior is figured out *//* gchar *    gtk_label_get_text      (GtkLabel         *label); */
 void       gtk_label_set_justify   (GtkLabel         *label,
                                    GtkJustification  jtype);
 void       gtk_label_set_pattern   (GtkLabel         *label,
index 8698b1303cf1c201a6da318f703a3884a4a6fcda..1cf4cd02377988cd8c340df619a07d652925ffda 100644 (file)
@@ -2700,6 +2700,14 @@ gtk_list_signal_item_toggle (GtkListItem *list_item,
   g_return_if_fail (list != NULL);
   g_return_if_fail (GTK_IS_LIST (list));
 
+  if ((list->selection_mode == GTK_SELECTION_BROWSE ||
+       list->selection_mode == GTK_SELECTION_EXTENDED) &&
+      GTK_WIDGET (list_item)->state == GTK_STATE_NORMAL)
+    {
+      gtk_widget_set_state (GTK_WIDGET (list_item), GTK_STATE_SELECTED);
+      return;
+    }
+  
   switch (GTK_WIDGET (list_item)->state)
     {
     case GTK_STATE_SELECTED:
index 8056c4a8a79ce9f3d783af13390c0c94f461598d..a2015c4ff7b423abfc845375e6025616dd0a7ca9 100644 (file)
@@ -110,6 +110,8 @@ static void gtk_menu_position       (GtkMenu           *menu);
 static void gtk_menu_reparent       (GtkMenu           *menu, 
                                     GtkWidget         *new_parent, 
                                     gboolean           unrealize);
+static void gtk_menu_remove         (GtkContainer      *menu,
+                                    GtkWidget         *widget);
 
 static GtkMenuShellClass *parent_class = NULL;
 static const gchar      *attach_data_key = "gtk-menu-attach-data";
@@ -169,6 +171,8 @@ gtk_menu_class_init (GtkMenuClass *class)
   widget_class->hide_all = gtk_menu_hide_all;
   widget_class->enter_notify_event = gtk_menu_enter_notify;
   widget_class->leave_notify_event = gtk_menu_leave_notify;
+
+  container_class->remove = gtk_menu_remove;
   
   menu_shell_class->submenu_placement = GTK_LEFT_RIGHT;
   menu_shell_class->deactivate = gtk_menu_deactivate;
@@ -396,6 +400,28 @@ gtk_menu_detach (GtkMenu *menu)
   gtk_widget_unref (GTK_WIDGET (menu));
 }
 
+void 
+gtk_menu_remove(GtkContainer *container,
+               GtkWidget    *widget)
+{
+  GtkMenu *menu;
+  g_return_if_fail (GTK_IS_MENU (container));
+  g_return_if_fail (GTK_IS_MENU_ITEM (widget));
+
+  menu = GTK_MENU (container);
+
+  /* Clear out old_active_menu_item if it matches the item we are removing
+   */
+  if (menu->old_active_menu_item == widget)
+    {
+      gtk_widget_unref (menu->old_active_menu_item);
+      menu->old_active_menu_item = NULL;
+    }
+
+  GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
+}
+
+
 GtkWidget*
 gtk_menu_new (void)
 {
index 145b7b75214c65cca99888e2ca138dde1e0349c2..04fa940b3c4563592d3b4aeaba1fed9aa531614e 100644 (file)
@@ -683,6 +683,12 @@ gtk_menu_shell_remove (GtkContainer *container,
   menu_shell = GTK_MENU_SHELL (container);
   menu_shell->children = g_list_remove (menu_shell->children, widget);
   
+  if (widget == menu_shell->active_menu_item)
+    {
+      gtk_item_deselect (GTK_ITEM (menu_shell->active_menu_item));
+      menu_shell->active_menu_item = NULL;
+    }
+
   gtk_widget_unparent (widget);
   
   /* queue resize regardless of GTK_WIDGET_VISIBLE (container),
index 4c0994af459804567e4be937ceb09ff9e85ea725..4bb12ec59745dbda9c404de9c932b33b5f89a8eb 100644 (file)
@@ -2547,8 +2547,8 @@ gtk_notebook_set_shape (GtkNotebook *notebook)
     }
   gdk_draw_rectangle(pm, pmgc, TRUE, x, y, width, height);
 
-  /* if theres an area for scrollign arrows draw the shape for them */
-  if (notebook->panel)
+  /* if theres an area for scrolling arrows draw the shape for them */
+  if (notebook->panel && gdk_window_is_visible (notebook->panel))
     {
       gdk_window_get_geometry(notebook->panel, &x, &y, &width, &height, &depth);
       gdk_draw_rectangle(pm, pmgc, TRUE, x, y, width, height);
index c329a289659bddd7cb70a2a07a0da5b95c10f3d6..65802151b2466ac6f41ddc9e2cf32e973c9a9654 100644 (file)
@@ -558,6 +558,56 @@ gtk_option_menu_changed (GtkOptionMenu *option_menu)
   g_signal_emit (G_OBJECT (option_menu), signals[CHANGED], 0);
 }
 
+static void
+gtk_option_menu_select_first_sensitive (GtkOptionMenu *option_menu)
+{
+  if (option_menu->menu)
+    {
+      GList *children = GTK_MENU_SHELL (option_menu->menu)->children;
+      gint index = 0;
+
+      while (children)
+       {
+         if (GTK_WIDGET_SENSITIVE (children->data))
+           {
+             gtk_option_menu_set_history (option_menu, index);
+             return;
+           }
+         
+         children = children->next;
+         index++;
+       }
+    }
+}
+
+static void
+gtk_option_menu_item_state_changed_cb (GtkWidget      *widget,
+                                      GtkStateType    previous_state,
+                                      GtkOptionMenu  *option_menu)
+{
+  GtkWidget *child = GTK_BIN (option_menu)->child;
+
+  if (child && GTK_WIDGET_SENSITIVE (child) != GTK_WIDGET_IS_SENSITIVE (widget))
+    gtk_widget_set_sensitive (child, GTK_WIDGET_IS_SENSITIVE (widget));
+}
+
+static void
+gtk_option_menu_item_destroy_cb (GtkWidget     *widget,
+                                GtkOptionMenu *option_menu)
+{
+  GtkWidget *child = GTK_BIN (option_menu)->child;
+
+  if (child)
+    {
+      gtk_widget_ref (child);
+      gtk_option_menu_remove_contents (option_menu);
+      gtk_widget_destroy (child);
+      gtk_widget_unref (child);
+
+      gtk_option_menu_select_first_sensitive (option_menu);
+    }
+}
+
 static void
 gtk_option_menu_update_contents (GtkOptionMenu *option_menu)
 {
@@ -580,14 +630,16 @@ gtk_option_menu_update_contents (GtkOptionMenu *option_menu)
          child = GTK_BIN (option_menu->menu_item)->child;
          if (child)
            {
-             if (GTK_BIN (option_menu)->child)
-               gtk_container_remove (GTK_CONTAINER (option_menu),
-                                     GTK_BIN (option_menu)->child);
-             if (GTK_WIDGET (option_menu)->state != child->state)
-               gtk_widget_set_state (child, GTK_WIDGET (option_menu)->state);
+             if (!GTK_WIDGET_IS_SENSITIVE (option_menu->menu_item))
+               gtk_widget_set_sensitive (child, FALSE);
              gtk_widget_reparent (child, GTK_WIDGET (option_menu));
            }
 
+         gtk_signal_connect (GTK_OBJECT (option_menu->menu_item), "state_changed",
+                             GTK_SIGNAL_FUNC (gtk_option_menu_item_state_changed_cb), option_menu);
+         gtk_signal_connect (GTK_OBJECT (option_menu->menu_item), "destroy",
+                             GTK_SIGNAL_FUNC (gtk_option_menu_item_destroy_cb), option_menu);
+
          gtk_widget_size_request (child, &child_requisition);
          gtk_widget_size_allocate (GTK_WIDGET (option_menu),
                                    &(GTK_WIDGET (option_menu)->allocation));
@@ -604,15 +656,28 @@ gtk_option_menu_update_contents (GtkOptionMenu *option_menu)
 static void
 gtk_option_menu_remove_contents (GtkOptionMenu *option_menu)
 {
+  GtkWidget *child;
+  
   g_return_if_fail (option_menu != NULL);
   g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
 
-  if (GTK_BIN (option_menu)->child)
+  if (option_menu->menu_item)
     {
-      if (GTK_WIDGET (option_menu->menu_item)->state != GTK_BIN (option_menu)->child->state)
-       gtk_widget_set_state (GTK_BIN (option_menu)->child,
-                             GTK_WIDGET (option_menu->menu_item)->state);
-      gtk_widget_reparent (GTK_BIN (option_menu)->child, option_menu->menu_item);
+      child = GTK_BIN (option_menu)->child;
+  
+      if (child)
+       {
+         gtk_widget_set_sensitive (child, TRUE);
+         gtk_widget_reparent (child, option_menu->menu_item);
+       }
+
+      gtk_signal_disconnect_by_func (GTK_OBJECT (option_menu->menu_item),
+                                    GTK_SIGNAL_FUNC (gtk_option_menu_item_state_changed_cb),
+                                    option_menu);                                   
+      gtk_signal_disconnect_by_func (GTK_OBJECT (option_menu->menu_item),
+                                    GTK_SIGNAL_FUNC (gtk_option_menu_item_destroy_cb),
+                                    option_menu);   
+      
       gtk_widget_unref (option_menu->menu_item);
       option_menu->menu_item = NULL;
     }
index 54a2dd769efc41c4a2c66af24d979d571312c59e..77e43d221a1b275e85cbcafaa7a28d536c5681b6 100644 (file)
@@ -926,7 +926,7 @@ gtk_range_button_press (GtkWidget      *widget,
        }
     }
 
-  return FALSE;
+  return TRUE;
 }
 
 static gint
@@ -982,7 +982,7 @@ gtk_range_button_release (GtkWidget      *widget,
       range->click_child = 0;
     }
 
-  return FALSE;
+  return TRUE;
 }
 
 static gint
@@ -1054,7 +1054,7 @@ gtk_range_motion_notify (GtkWidget      *widget,
        }
     }
 
-  return FALSE;
+  return TRUE;
 }
 
 static gint
@@ -1156,7 +1156,7 @@ gtk_range_enter_notify (GtkWidget        *widget,
        gtk_range_draw_step_back (range);
     }
 
-  return FALSE;
+  return TRUE;
 }
 
 static gint
@@ -1194,7 +1194,7 @@ gtk_range_leave_notify (GtkWidget        *widget,
        gtk_range_draw_step_back (range);
     }
 
-  return FALSE;
+  return TRUE;
 }
 
 static gint
@@ -1207,7 +1207,7 @@ gtk_range_focus_in (GtkWidget     *widget,
   GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
   gtk_widget_draw_focus (widget);
 
-  return FALSE;
+  return TRUE;
 }
 
 static gint
@@ -1220,7 +1220,7 @@ gtk_range_focus_out (GtkWidget     *widget,
   GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
   gtk_widget_draw_focus (widget);
 
-  return FALSE;
+  return TRUE;
 }
 
 static void
index 03a12b3bfe3d0691b39a9d196a76742e8a458c04..a67ee40600290d74271d0359fafbb449580dc008 100644 (file)
@@ -297,11 +297,11 @@ gtk_rc_make_default_dir (const gchar *type)
 #ifndef G_OS_WIN32
   var = getenv("GTK_EXE_PREFIX");
   if (var)
-    path = g_strdup_printf("%s%s%s", var, "/lib/gtk-2.0/" GTK_VERSION "/", type);
+    path = g_strconcat (var, "/lib/gtk-2.0/" GTK_VERSION "/", type, NULL);
   else
-    path = g_strdup_printf("%s%s%s", GTK_EXE_PREFIX, "/lib/gtk-2.0/" GTK_VERSION "/", type);
+    path = g_strconcat (GTK_LIBDIR "/gtk-2.0/" GTK_VERSION "/", type, NULL);
 #else
-  path = g_strdup_printf ("%s\\%s", get_themes_directory (), type);
+  path = g_strconcat ("%s\\%s", get_themes_directory (), type);
 #endif
 
   return path;
@@ -351,9 +351,9 @@ gtk_rc_get_theme_dir(void)
 #ifndef G_OS_WIN32
   var = getenv("GTK_DATA_PREFIX");
   if (var)
-    path = g_strdup_printf("%s%s", var, "/share/themes");
+    path = g_strconcat (var, "/share/themes", NULL);
   else
-    path = g_strdup_printf("%s%s", GTK_DATA_PREFIX, "/share/themes");
+    path = g_strconcat (GTK_DATA_PREFIX, "/share/themes", NULL);
 #else
   path = g_strdup (get_themes_directory ());
 #endif
@@ -380,11 +380,11 @@ gtk_rc_append_default_module_path(void)
 #ifndef G_OS_WIN32
   var = getenv("GTK_EXE_PREFIX");
   if (var)
-    path = g_strdup_printf("%s%s", var, "/lib/gtk-2.0/" GTK_VERSION "/engines");
+    path = g_strconcat(var, "/lib/gtk-2.0/" GTK_VERSION "/engines", NULL);
   else
-    path = g_strdup_printf("%s%s", GTK_EXE_PREFIX, "/lib/gtk-2.0/" GTK_VERSION "/engines");
+    path = g_strdup (GTK_LIBDIR "/gtk-2.0/" GTK_VERSION "/engines");
 #else
-  path = g_strdup_printf ("%s%s", get_themes_directory (), "\\engines");
+  path = g_strconcat (get_themes_directory (), "\\engines", NULL);
 #endif
   module_path[n++] = path;
 
@@ -400,10 +400,10 @@ gtk_rc_append_default_module_path(void)
       else
        sep = "";
       /* This produces something like ~/.gtk-2.0/2.0/engines */
-      path = g_strdup_printf ("%s%s%s", var, sep,
-                             ".gtk-2.0" G_DIR_SEPARATOR_S
-                             GTK_VERSION G_DIR_SEPARATOR_S
-                             "engines");
+      path = g_strconcat (var, sep,
+                         ".gtk-2.0" G_DIR_SEPARATOR_S
+                         GTK_VERSION G_DIR_SEPARATOR_S
+                         "engines", NULL);
       module_path[n++] = path;
     }
   module_path[n] = NULL;
index 054bf21dfce581b36724599f67eb7239a7c66673..30c75cf9078844d4853017c8f0294f8180e6b75e 100644 (file)
@@ -635,6 +635,9 @@ gtk_style_detach (GtkStyle *style)
     {
       GTK_STYLE_GET_CLASS (style)->unrealize (style);
       
+      gdk_colormap_unref (style->colormap);
+      style->colormap = NULL;
+      
       gtk_style_unref (style);
     }
 }
@@ -657,7 +660,7 @@ gtk_style_realize (GtkStyle    *style,
 {
   g_return_if_fail (GTK_IS_STYLE (style));
   
-  style->colormap = colormap;
+  style->colormap = gdk_colormap_ref (colormap);
   style->depth = gdk_colormap_get_visual (colormap)->depth;
 
   GTK_STYLE_GET_CLASS (style)->realize (style);
@@ -1231,7 +1234,18 @@ gtk_style_real_unrealize (GtkStyle *style)
       gtk_gc_release (style->mid_gc[i]);
       gtk_gc_release (style->text_gc[i]);
       gtk_gc_release (style->base_gc[i]);
+
+      if (style->bg_pixmap[i] &&  style->bg_pixmap[i] != (GdkPixmap*) GDK_PARENT_RELATIVE)
+       gdk_pixmap_unref (style->bg_pixmap[i]);
     }
+  
+  gdk_colormap_free_colors (style->colormap, style->fg, 5);
+  gdk_colormap_free_colors (style->colormap, style->bg, 5);
+  gdk_colormap_free_colors (style->colormap, style->light, 5);
+  gdk_colormap_free_colors (style->colormap, style->dark, 5);
+  gdk_colormap_free_colors (style->colormap, style->mid, 5);
+  gdk_colormap_free_colors (style->colormap, style->text, 5);
+  gdk_colormap_free_colors (style->colormap, style->base, 5);
 }
 
 static void
index 5933396703b4d92b19562178740750bdf474828f..31b83d42741ba09bd64eeb6ddb4099482d689462 100644 (file)
@@ -1505,19 +1505,30 @@ static void
 clear_focus_area (GtkText *text, gint area_x, gint area_y, gint area_width, gint area_height)
 {
   GtkWidget *widget = GTK_WIDGET (text);
-  
+  GdkGC *gc;
   gint ythick = TEXT_BORDER_ROOM + widget->style->ythickness;
   gint xthick = TEXT_BORDER_ROOM + widget->style->xthickness;
   
   gint width, height;
   
-  gdk_window_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
+  if (area_width == 0 || area_height == 0)
+    return;
+    
+  if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
+    {
+      gdk_window_get_size (widget->style->bg_pixmap[GTK_STATE_NORMAL], &width, &height);
   
-  gdk_gc_set_ts_origin (text->bg_gc,
-                       (- text->first_onscreen_hor_pixel + xthick) % width,
-                       (- text->first_onscreen_ver_pixel + ythick) % height);
+      gdk_gc_set_ts_origin (text->bg_gc,
+                           (- text->first_onscreen_hor_pixel + xthick) % width,
+                           (- text->first_onscreen_ver_pixel + ythick) % height);
+      
+       gc = text->bg_gc;
+    }
+  else
+    gc = widget->style->bg_gc[widget->state];
 
-  gdk_draw_rectangle (GTK_WIDGET (text)->window, text->bg_gc, TRUE,
+  gdk_draw_rectangle (GTK_WIDGET (text)->window, gc, TRUE,
                      area_x, area_y, area_width, area_height);
 }
 
@@ -1573,19 +1584,16 @@ gtk_text_draw_focus (GtkWidget *widget)
       width -= 2 * xthick;
       height -= 2 * ythick;
       
-      if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
-       {
-         /* top rect */
-         clear_focus_area (text, x, y, width, yextra);
-         /* left rect */
-         clear_focus_area (text, x, y + yextra, 
-                           xextra, y + height - 2 * yextra);
-         /* right rect */
-         clear_focus_area (text, x + width - xextra, y + yextra, 
-                           xextra, height - 2 * ythick);
-         /* bottom rect */
-         clear_focus_area (text, x, x + height - yextra, width, yextra);
-       }
+      /* top rect */
+      clear_focus_area (text, x, y, width, yextra);
+      /* left rect */
+      clear_focus_area (text, x, y + yextra, 
+                       xextra, y + height - 2 * yextra);
+      /* right rect */
+      clear_focus_area (text, x + width - xextra, y + yextra, 
+                       xextra, height - 2 * ythick);
+      /* bottom rect */
+      clear_focus_area (text, x, x + height - yextra, width, yextra);
     }
   else
     {
index dc6aa2a12ca8db9476e4492f02ad99de5e4972cc..09f39f9d92e218c4d06e29d33d90ad12306ec2c6 100644 (file)
@@ -1863,27 +1863,18 @@ gtk_window_real_set_focus (GtkWindow *window,
       event.window = window->focus_widget->window;
       event.in = TRUE;
 
-      if (window->default_widget)
-        {
-          if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
-             (window->focus_widget != window->default_widget))
-            {
-             if (GTK_WIDGET_CAN_DEFAULT (window->focus_widget))
-               GTK_WIDGET_SET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
-             GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
-            }
-         else
-           {
-             GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
-           }
+      if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
+         (window->focus_widget != window->default_widget))
+       {
+         if (GTK_WIDGET_CAN_DEFAULT (window->focus_widget))
+           GTK_WIDGET_SET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
+
+         if (window->default_widget)
+           GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
        }
       
       gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
     }
-  else if (window->default_widget)
-    {
-      GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
-    }
   
   if (window->default_widget &&
       (def_flags != GTK_WIDGET_FLAGS (window->default_widget)))
index 73a151ec5f516c6b5e5b1283071f7c76dccda0a1..c5c460d53176a93ada318ab5e7aca7c93b60c70e 100644 (file)
@@ -2913,11 +2913,19 @@ static GtkItemFactoryEntry menu_items[] =
   { "/_Preferences/Shape/_Square",      NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
   { "/_Preferences/Shape/_Rectangle",   NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
   { "/_Preferences/Shape/_Oval",        NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
+  { "/_Preferences/Shape/_Rectangle",   NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
+  { "/_Preferences/Shape/_Oval",        NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
+
+  /* For testing deletion of menus */
+  { "/_Preferences/Should_NotAppear",          NULL, 0,               0, "<Branch>" },
+  { "/Preferences/ShouldNotAppear/SubItem1",   NULL, gtk_ifactory_cb, 0 },
+  { "/Preferences/ShouldNotAppear/SubItem2",   NULL, gtk_ifactory_cb, 0 },
 
   { "/_Help",            NULL,         0,                     0, "<LastBranch>" },
   { "/Help/_About",      NULL,         gtk_ifactory_cb,       0 },
 };
 
+
 static int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
 
 static void
@@ -2990,6 +2998,8 @@ create_item_factory (void)
       GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
       gtk_widget_grab_default (button);
 
+      gtk_item_factory_delete_item (item_factory, "/Preferences/ShouldNotAppear");
+      
       gtk_widget_show_all (window);
     }
   else
index 73a151ec5f516c6b5e5b1283071f7c76dccda0a1..c5c460d53176a93ada318ab5e7aca7c93b60c70e 100644 (file)
@@ -2913,11 +2913,19 @@ static GtkItemFactoryEntry menu_items[] =
   { "/_Preferences/Shape/_Square",      NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
   { "/_Preferences/Shape/_Rectangle",   NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
   { "/_Preferences/Shape/_Oval",        NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
+  { "/_Preferences/Shape/_Rectangle",   NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
+  { "/_Preferences/Shape/_Oval",        NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
+
+  /* For testing deletion of menus */
+  { "/_Preferences/Should_NotAppear",          NULL, 0,               0, "<Branch>" },
+  { "/Preferences/ShouldNotAppear/SubItem1",   NULL, gtk_ifactory_cb, 0 },
+  { "/Preferences/ShouldNotAppear/SubItem2",   NULL, gtk_ifactory_cb, 0 },
 
   { "/_Help",            NULL,         0,                     0, "<LastBranch>" },
   { "/Help/_About",      NULL,         gtk_ifactory_cb,       0 },
 };
 
+
 static int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
 
 static void
@@ -2990,6 +2998,8 @@ create_item_factory (void)
       GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
       gtk_widget_grab_default (button);
 
+      gtk_item_factory_delete_item (item_factory, "/Preferences/ShouldNotAppear");
+      
       gtk_widget_show_all (window);
     }
   else